apiready = function() {
    seajs.use(['../../V', "../../api", "../../jquery", "../../app", "../../service"], function(V, $api, $, app, service) {
        var vm = {
            el: '.container',
            data: {
                withdrawalList: '',
                shopId: '',
                page: 1,
                yzc_status: ''
            },
            mounted: function() {

            },
            methods: {
                //--返回
                close: function() {
                    api.closeWin();
                },
                //--获取可提现金额
                getWithdrawalList: function(scrolltobottom) {
                    var that = this;
                    var yzc_status = api.pageParam.yzc_status ? 1 : 0;
                    app.ajax(service['withdrawalList'], {
                            data: {
                                values: {
                                    shop_code: api.pageParam.shopId,
                                    unionid: $api.getStorage("shop_unionid"),
                                    page: this.page,
                                    yzc_status: yzc_status
                                }
                            }
                        },
                        function(res) {
                            // var shopCode = res.data.shop_code; // 商店id
                            if (res.code) {
                                alert("错误号码code：" + res.code + "\n错误信息：" + res.message)
                            } else {
                                if (!scrolltobottom) {
                                    if (res.data != '') {
                                        that.withdrawalList = res.data;
                                    } else {
                                        $(".list_null").css("display", "block");
                                    }
                                } else {
                                    if (res.data != '') {
                                        that.withdrawalList = that.withdrawalList.concat(res.data);
                                    } else {
                                        if (that.page != 1) {
                                            that.page = parseInt(that.page - 1);
                                            api.toast({
                                                msg: '没有更多数据...',
                                                duration: 2000,
                                                location: 'middle'
                                            });
                                        }
                                    }

                                }
                                console.log(JSON.stringify(that.withdrawalList))
                                console.log("获取结算中列表成功!");
                            }
                        }
                    );
                },
                //--前往分享
                toGoodsMange: function() {
                    app.openWin('goodsManage', {
                        shopId: api.pageParam.shopId
                    });
                },
                // 触底
                scrolltobottom: function() {
                    var that = this;
                    this.page = parseInt(this.page + 1);

                    var scrolltobottom = 1;
                    this.getWithdrawalList(scrolltobottom);
                }
            },
            created: function() {
                var that = this;
                var scrolltobottom = 0;
                this.getWithdrawalList(scrolltobottom);

                this.yzc_status = api.pageParam.yzc_status;
                console.log('yzc_status: ' + this.yzc_status);

                api.addEventListener({
                    name: 'scrolltobottom',
                    extra: {
                        threshold: 0 //设置距离底部多少距离时触发，默认值为0，数字类型
                    }
                }, function(ret, err) {
                    that.scrolltobottom()
                });
            }
        };

        var even = function() {

        };
        var newVue = new Vue(vm);
        even();

    })
}
